function Viewer(option) {
  this.option = Cesium.defaultValue(option, Cesium.defaultValue.EMPTY_OBJECT);
  this.scene3DOnly = (option && option.scene3DOnly) ? option.scene3DOnly : true,
    this.selectionIndicator = (option && option.selectionIndicator) ? option.selectionIndicator : false,
    this.animation = (option && option.animation) ? option.animation : false,
    this.timeline = (option && option.timeline) ? option.timeline : false,
    this.navigationHelpButton = (option && option.navigationHelpButton) ? option.navigationHelpButton : false,
    this.fullscreenButton = (option && option.fullscreenButton) ? option.fullscreenButton : false,
    this.geocoder = (option && option.geocoder) ? option.geocoder : false,
    this.homeButton = (option && option.homeButton) ? option.homeButton : false,
    this.shouldAnimate = (option && option.shouldAnimate) ? option.shouldAnimate : false,
    this.sceneModePicker = (option && option.sceneModePicker) ? option.sceneModePicker : false,
    this.shouldAnimate = (option && option.shouldAnimate) ? option.shouldAnimate : true,
    this.infoBox = (option && option.infoBox) ? option.infoBox : false,
    this.requestRenderMode = (option && option.requestRenderMode) ? option.requestRenderMode : false,
    this.navigationInstructionsInitiallyVisible = (option && option.navigationInstructionsInitiallyVisible) ? option.navigationInstructionsInitiallyVisible :false,
    this.baseLayerPicker = (option && option.baseLayerPicker) ? option.baseLayerPicker : false,
    this.maximumRequests = (option && option.maximumRequests) ? option.maximumRequests : 50;
  this.maximumRequestsPerServer = (option && option.maximumRequestsPerServer) ? option.maximumRequestsPerServer : 6;
  this.throttleRequests = (option && option.throttleRequests) ? option.throttleRequests : true;
  this.defaultAccessToken = (option && option.defaultAccessToken) ? option.defaultAccessToken :'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiZjliY2NhNS1iMThiLTQzZTYtOWM1ZS03NDMxMmY3YjIyNmUiLCJpZCI6MjAwNDcsInNjb3BlcyI6WyJhc2wiLCJhc3IiLCJhc3ciLCJnYyJdLCJpYXQiOjE1ODMxOTk3NTl9.lzdqsXU24bvovmmaRPXcD3jmSH0WmYTwmX6isCx8qfA';
  let _this = this;
  Cesium.RequestScheduler.maximumRequests = _this.maximumRequests;
  Cesium.RequestScheduler.maximumRequestsPerServer = _this.maximumRequestsPerServer;
  Cesium.RequestScheduler.throttleRequests = _this.throttleRequests;
  Cesium.throttleRequestByServer.maximumRequestsPerServer=1024;
  
  Cesium.Ion.defaultAccessToken = _this.defaultAccessToken;

  _this.viewer = new Cesium.Viewer(this.option.domId, {
    scene3DOnly: _this.scene3DOnly,
    selectionIndicator: _this.selectionIndicator,
    baseLayerPicker: _this.baseLayerPicker,
    animation: _this.animation,
    timeline: _this.timeline,
    navigationHelpButton: _this.navigationHelpButton,
    fullscreenButton: _this.fullscreenButton,
    geocoder: _this.geocoder,
    homeButton: _this.homeButton,
    shouldAnimate: _this.shouldAnimate,
    sceneModePicker: _this.sceneModePicker,
    shouldAnimate: _this.shouldAnimate,
    infoBox: _this.infoBox,
    requestRenderMode: _this.requestRenderMode,
    navigationInstructionsInitiallyVisible: _this.navigationInstructionsInitiallyVisible,
    baseLayerPicker: _this.baseLayerPicker,
    contextOptions: {
      webgl: {
        alpha: true,
        depth: true,
        stencil: true,
        antialias: true,
        premultipliedAlpha: true,
        preserveDrawingBuffer: true,
        failIfMajorPerformanceCaveat: true
      }
    },
/*    imageryProvider: new Cesium.WebMapTileServiceImageryProvider({
    	url: "http://t0.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=9762e665a084d0bed485e09ce57e2728",
        layer: "tdtBasicLayer",
        style: "default",
        format: "image/jpeg",
        tileMatrixSetID: "GoogleMapsCompatible",
        show: false
    })*/
  });
	this.viewer.scene.globe.depthTestAgainstTerrain = false;
	this.viewer.cesiumWidget.creditContainer.style.display = "none";

  //设置操作习惯(禁止中间滑轮调整视角)
	this.viewer.scene.screenSpaceCameraController.zoomEventTypes = [Cesium.CameraEventType.WHEEL, Cesium.CameraEventType.PINCH];
	this.viewer.scene.screenSpaceCameraController.tiltEventTypes = [Cesium.CameraEventType.PINCH, Cesium.CameraEventType.RIGHT_DRAG];

	//解决模糊问题
	if(Cesium.FeatureDetection.supportsImageRenderingPixelated()){//判断是否支持图像渲染像素化处理
		this.viewer.resolutionScale = window.devicePixelRatio;
	}
	//是否开启抗锯齿
	this.viewer.scene.fxaa = true;
	this.viewer.scene.postProcessStages.fxaa.enabled = true;

	// 去掉entity的点击事件 start
	this.viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
	this.viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK)
	this.viewer.scene.globe.baseColor = new Cesium.Color.fromCssColorString("#546a53"); //地表背景色
  return _this.viewer;
}
